package com.ruoyi.teamManagement.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.teamManagement.domain.DocTeam;
import com.ruoyi.teamManagement.service.IDocTeamService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 签约团队管理Controller
 *
 * @author ruoyi
 * @date 2025-08-14
 */
@RestController
@RequestMapping("/teamManagement/docTeam")
public class DocTeamController extends BaseController
{
    @Autowired
    private IDocTeamService docTeamService;

    /**
     * 查询签约团队管理列表
     */
    @ApiOperation("查询签约团队管理列表")
    @PreAuthorize("@ss.hasPermi('teamManagement:docTeam:list')")
    @GetMapping("/list")
    public TableDataInfo list(DocTeam docTeam)
    {
        startPage();
        List<DocTeam> list = docTeamService.selectDocTeamList(docTeam);
        return getDataTable(list);
    }

    /**
     * 导出签约团队管理列表
     */
    @ApiOperation("导出签约团队管理列表")
    @PreAuthorize("@ss.hasPermi('teamManagement:docTeam:export')")
    @Log(title = "签约团队管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DocTeam docTeam)
    {
        List<DocTeam> list = docTeamService.selectDocTeamList(docTeam);
        ExcelUtil<DocTeam> util = new ExcelUtil<DocTeam>(DocTeam.class);
        util.exportExcel(response, list, "签约团队管理数据");
    }

    /**
     * 获取签约团队管理详细信息
     */
    @ApiOperation("获取签约团队管理详细信息")
    @PreAuthorize("@ss.hasPermi('teamManagement:docTeam:query')")
    @GetMapping(value = "/{teamId}")
    public AjaxResult getInfo(@PathVariable("teamId") Long teamId)
    {
        return success(docTeamService.selectDocTeamByTeamId(teamId));
    }

    /**
     * 新增签约团队管理
     */
    @ApiOperation("新增签约团队管理")
    @PreAuthorize("@ss.hasPermi('teamManagement:docTeam:add')")
    @Log(title = "签约团队管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DocTeam docTeam)
    {
        return toAjax(docTeamService.insertDocTeam(docTeam));
    }

    /**
     * 修改签约团队管理
     */
    @ApiOperation("修改签约团队管理")
    @PreAuthorize("@ss.hasPermi('teamManagement:docTeam:edit')")
    @Log(title = "签约团队管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DocTeam docTeam)
    {
        return toAjax(docTeamService.updateDocTeam(docTeam));
    }

    /**
     * 删除签约团队管理
     */
    @ApiOperation("删除签约团队管理")
    @PreAuthorize("@ss.hasPermi('teamManagement:docTeam:remove')")
    @Log(title = "签约团队管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{teamIds}")
    public AjaxResult remove(@PathVariable Long[] teamIds)
    {
        return toAjax(docTeamService.deleteDocTeamByTeamIds(teamIds));
    }
}
